home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #3 / Amiga Plus CD - 2002 - No. 03.iso / AmiSoft / Dev / Gui / Cit.lha / CIT / Demo / ButtonTest.cpp next >
Encoding:
C/C++ Source or Header  |  2003-02-15  |  1.7 KB  |  86 lines

  1. #include "CITGroup.h"
  2. #include "CITText.h"
  3. #include "CITButton.h"
  4.  
  5. CITApp Application;
  6.  
  7. CITWorkbench DemoScreen;
  8. CITWindow    DemoWindow;
  9. CITVGroup    group;
  10. CITText      text;
  11. CITButton    quitButton;
  12. CITButton    okButton;
  13.  
  14. void CloseEvent();
  15. void QuitEvent(ULONG ID,ULONG eventFlag);
  16.  
  17. int main(void)
  18. {
  19.   BOOL Error=FALSE;
  20.  
  21.   //DemoScreen.DefaultFont("CGTimes.font",24,24);
  22.   DemoScreen.InsObject(DemoWindow,Error);
  23.     DemoWindow.Position(WPOS_CENTERSCREEN);
  24.     DemoWindow.CloseGadget();
  25.     DemoWindow.DragBar();
  26.     DemoWindow.SizeGadget();
  27.     DemoWindow.DepthGadget();
  28.     DemoWindow.IconifyGadget();
  29.     DemoWindow.Caption("CITGadgets");
  30.     DemoWindow.CloseEventHandler(CloseEvent);
  31.     //DemoWindow.DefaultFont("CGTimes.font",24,24);
  32.     DemoWindow.InsObject(group,Error);
  33.       group.BevelStyle();
  34.       //group.BevelLabel("En tekst");
  35.       group.InsObject(text,Error);
  36.         text.Text("Text Gadget");
  37.       group.InsObject(okButton,Error);
  38.         okButton.Text("Ok");
  39.       group.InsObject(quitButton,Error);
  40.         quitButton.Font("CGTimes.font",24,24);
  41.         quitButton.Text("Quit");
  42.         quitButton.EventHandler(QuitEvent);
  43.  
  44.   Application.InsObject(DemoScreen,Error);
  45.  
  46.   // Ok?
  47.   if( Error )
  48.     return 10;
  49.  
  50.   Application.Run();
  51.  
  52.   return 0;
  53. }
  54.  
  55. void QuitEvent(ULONG ID,ULONG eventFlag)
  56. {
  57.   Application.Stop();
  58. }
  59.  
  60. int repeatCount = 0;
  61.  
  62. void CloseEvent()
  63. {
  64.   BOOL Error=FALSE;
  65.  
  66.   repeatCount++;
  67.  
  68.   switch( repeatCount )
  69.   {
  70.     case 1:
  71.       //DemoWindow.Position(50,50);
  72.       Application.RemObject(DemoScreen);
  73.       //Delay(100);
  74.  
  75.       DemoScreen.Display(DEF_MONITOR);
  76.       Application.InsObject(DemoScreen,Error);
  77.       break;
  78.     case 2:
  79.       DemoWindow.Size(300,180);
  80.       break;
  81.     default:
  82.       Application.Stop();
  83.       break;
  84.   }
  85. }
  86.